import { FilterDTO } from "@/api/interface";

//默认每页显示条数
export const defaultPageSize = 15;

export const initFilter = {
	offset: 0,
	size: defaultPageSize,
}

export function getPage(total:number, onFilterChange:(val:FilterDTO)=>void){
    return {
        total: total,
        defaultPageSize: defaultPageSize,
        pageSizeOptions: [15,30,50,100],
        showSizeChanger: true,
        showTotal: (total:number) => '总数：' +  total,
        onChange: (page:number, pageSize:number) => {
            onFilterChange({offset: (page-1) * pageSize, size: pageSize})
        }
    }
}